package com.hopu.mcshipin.util;

import lombok.Getter;

@Getter
public enum ErrorCode {
    SUCCESS(200, "成功"),
    FAIL(-1, "失败"),

    // 参数错误 10000-19999
    PARAM_IS_NULL(10001, "参数为空"),
    USERNAME_IS_EMPTY(10002, "用户名为空"),
    USERNAME_FORMAT_INVALID(10003, "用户名格式不正确(4-20位字母数字下划线)"),
    USERNAME_ALREADY_EXISTS(10004, "用户名已存在"),
    PASSWORD_IS_EMPTY(10005, "密码为空"),
    PASSWORD_LENGTH_INVALID(10006, "密码长度不正确(6-20位)"),
    EMAIL_FORMAT_INVALID(10007, "邮箱格式不正确"),
    EMAIL_ALREADY_EXISTS(10008, "邮箱已注册"),
    PHONE_FORMAT_INVALID(10009, "手机号格式不正确"),
    PHONE_ALREADY_EXISTS(10010, "手机号已绑定"),
    EMAIL_OR_PHONE_IS_EMPTY(10011, "邮箱或手机号至少需要填写一个"),
    PARAM_NOT_VALID(10012, "参数无效"),

    // 业务错误 20000-29999
    USER_NOT_EXIST(20001, "用户不存在"),
    PASSWORD_ERROR(20002, "密码错误"),
    USER_DISABLED(20003, "用户已被禁用"),
    USER_NOT_LOGIN(20004, "用户未登录"),

    // 系统错误 30000-39999
    DB_OPERATION_ERROR(30001, "数据库操作失败"),
    SYSTEM_ERROR(30002, "系统异常"),
    NETWORK_ERROR(30003, "网络异常"),
    SERVICE_UNAVAILABLE(30004, "服务不可用"),

    // 文件相关错误 40000-49999
    FILE_IS_EMPTY(40001, "文件不能为空"),
    FILE_TYPE_NOT_SUPPORTED(40002, "不支持的文件类型"),
    FILE_SIZE_EXCEEDED(40003, "文件大小超过限制"),
    FILE_UPLOAD_ERROR(40004, "文件上传失败"),
    FILE_NOT_FOUND(40005, "文件不存在"),
    AUDIO_PARSE_ERROR(40006, "音频解析失败");



    private final int code;
    private final String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}